<?php

/**
 * @author gbfun <gbfun@163.com>  2018-06-23 15:40
 * http://www.wuweiyou.com
 */

class db_table_background_order extends db_table_order
{    
    protected static $_instance;
    
    public static function get_instance()
    {
        if (null === self::$_instance) {
            self::$_instance = new self();    //by gbfun 又是静态变量
        }
    
        return self::$_instance;
    }
    
    public function update($order_info)
    {
        $write_db = $this->_get_write_db();
        //var_dump($write_db); exit();
    
        $sql = '
            UPDATE ' . $this->_full_name . '
            SET
                `shipping_id` = ?,
                `shipping_name` = ?,
                `shipping_sn` = ?,
                `shipping_time` = ?,
                `status` = ?,
                `update_time` = ?
    
            WHERE `id` = ?
        ';
    
        $bind = array(
            $order_info['shipping_id'],
            $order_info['shipping_name'],
            $order_info['shipping_sn'],
            $order_info['shipping_time'],
            $order_info['status'],
            $order_info['update_time'],
    
            $order_info['id'],
        );
    
        $stmt   = $write_db->query($sql, $bind);
        $result = $stmt->rowCount();
        //var_dump($result); exit();
    
        return $result;
    }    
}

